/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.action;

import com.dao.Usermanager;
import com.entity.Student;
import static com.opensymphony.xwork2.Action.INPUT;
import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionSupport;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.swing.JOptionPane;
import org.apache.struts2.ServletActionContext;

/**
 *
 * @author DELL
 */
public class UpdateMessage extends ActionSupport{
    
    
    
    
    private String userName;
    private String sno;
    private String email;
    private String tel;
    private String mark;
    private String sex;
    private String department;
    private String jiguan;
   




  

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }


    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getTel() {
        return this.tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

  

    public String getSex() {
        return this.sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getDepartment() {
        return this.department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getJiguan() {
        return this.jiguan;
    }

    public void setJiguan(String jiguan) {
        this.jiguan = jiguan;
    }

 


 
  

    
    
    public UpdateMessage() {
    }
    
    public String execute() throws Exception {
        
         Logger.getLogger(this.getClass().getName()).log(Level.INFO, getUserName());
        
        
                         HttpServletRequest request;
        request =ServletActionContext.getRequest();
                HttpSession session=request.getSession();
        String sno =(String)session.getAttribute("sno");
         
         Student st1=new Student();
         Student st2=new Student();
         st1=(Student)session.getAttribute("student");
         
          Logger.getLogger(this.getClass().getName()).log(Level.INFO, sno);
         
         st2.setStId(st1.getStId());
         st2.setSno(sno);
          st2.setMaxClasses(st1.getMaxClasses());
          st2.setPassword(st1.getPassword());
           st2.setMark(st1.getMark());
            st2.setEmail(getEmail());
            st2.setJiguan(getJiguan());
            st2.setSex(getSex());
            st2.setUserName(getUserName());
             st2.setDepartment(getDepartment());
             st2.setJiguan(getJiguan());
              st2.setTel(getTel());
                Logger.getLogger(this.getClass().getName()).log(Level.INFO, getTel());
        if (sno!=null) {
            
            
             Logger.getLogger(this.getClass().getName()).log(Level.INFO, "111111111111111");
                    Usermanager  user=new Usermanager();
        
                     JOptionPane.showMessageDialog(null, "更新信息成功", "消息提示", JOptionPane.YES_NO_CANCEL_OPTION);
                    
        user.updateStudent1(st2);
          
        
    
       
        return SUCCESS;
        }
        else {
        
        return INPUT;
        }
    }
        
        
    
    
}
